package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanhua.dubbo.mapper.BlackListMapper;
import com.tanhua.dubbo.mapper.UserInfoMapper;
import com.tanhua.model.domian.BlackList;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;


@DubboService
public class BlackListApiImpl implements BlackListApi {

    @Autowired
    private BlackListMapper blackListMapper;
    @Autowired
    private UserInfoMapper userInfoMapper;


    @Override
    public void save(BlackList blackList) {
        blackListMapper.insert(blackList);
    }

    @Override
    public void update(BlackList blackList) {
        blackListMapper.updateById(blackList);
    }


    @Override
    public BlackList findById(Long id) {
        return blackListMapper.selectById(id);
    }

    @Override
    public void blacklistdelete(Long uid, Long userId) {
        LambdaQueryWrapper<BlackList> bqw = new LambdaQueryWrapper<>();
        bqw.eq(BlackList::getUserId,userId).eq(BlackList::getBlackUserId,uid);
        blackListMapper.delete(bqw);
    }

   /* @Override
    public IPage<UserInfo> findByUserId(Long userId, int page, int size) {
        Page page1 = new Page(page, size);
        return userInfoMapper.findblackList(page1,userId);
    }*/

}
